package com.mycompany.myapplication;

import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
public class LoginPanel extends VerticalLayout{
	
	private TextField username;
	private TextField password;
	private Button button;
	
	public LoginPanel() {
		super();
		init();
	}

	private void init() {
		
		username = new TextField("Username");
		password = new TextField("Password");
		button = new Button ("button");
		
		VerticalLayout verticalLayout = new VerticalLayout();
		verticalLayout.addComponent(username);
		verticalLayout.addComponent(password);
		verticalLayout.addComponent(button);
		verticalLayout.setSpacing(true);
		verticalLayout.setMargin(true);
		
		addComponent(verticalLayout);
		
		button.addClickListener(new Button.ClickListener() {
			
			@Override
			public void buttonClick(ClickEvent event) {
				addComponent(new Label("MyLabel"));
				System.out.println("ok");
			}
		});
	}
	

}
